The present invention relates generally to systems and methods for compression and reconstruction of color image data, and particularly to a system and method for efficiently encoding YUV image data.
Digital images and digital video signals are often encoded in the YCbCr format, where Y is the xe2x80x9cluminancexe2x80x9d signal, and Cb and Cr are xe2x80x9ccolor-differencexe2x80x9d signals that carry chrominance information. Note that the YCbCr color space is sometimes loosely referred to as the YUV color space. In actuality, YUV (which we will hereinafter refer to as Yxe2x80x2UV) signals are typically used as an intermediate step in the formation of composite NTSC/PAL color television signals. The Yxe2x80x2, U and V signals are respectively related to the Y, Cb and Cr signals as follows:
Yxe2x80x2=1.164(Yxe2x88x9216) 
U=Cbxe2x88x92128 
V=1.4(Crxe2x88x92128) 
Nevertheless, for the purposes of this document, the terms YUV and YCbCr will be used synonymously, since the information content of the each of the Yxe2x80x2, U and V signal components in YUV signals is exactly the same as the information content of the Y, Cb and Cr components of YCbCr signals.
Color monitors such as those used as the display terminals for personal computers, as well as the liquid crystal displays in digital cameras and other devices, are usually driven by signals encoded in an RGB (Red, Green, Blue) format. Therefore, a transformation from the YCbCr format to the RGB format is required in order to display a YCbCr-encoded video signal on a color monitor. The relationship between YCbCr and RGB signals can be specified by the following matrix of equations:
R=1.164(Yxe2x88x9216)+1.596(Crxe2x88x92128) 
G=1.164(Yxe2x88x9216)xe2x88x920.813(Crxe2x88x92128)xe2x88x920.391(Cbxe2x88x92128) 
B=1.164(Yxe2x88x9216)+2.018(Cbxe2x88x92128) 
This YCbCr to RGB conversion is compliant with CCIR Recommendation 601-1, Reports of the International Radio Consultative Committee, International Telecommunications Union. The inverse equations, for converting RGB data to YCbCr format are:
Y=0.299*R+0.587*G+0.114*B 
Cb=xe2x88x920.169*Rxe2x88x920.331*Gxe2x88x920.500*B+128 
Cr=0.500*Rxe2x88x920.419*Gxe2x88x920.081*B+128 
JPEG is a standardized still image compression mechanism. JPEG stands for Joint Photographic Experts Group, the original name of the group that formed the standard. JPEG is designed for compressing either full-color or gray scale images. In this document, only the xe2x80x9clossyxe2x80x9d mode of JPEG will be considered. This means that the decompressed image is not exactly the same as the original image. In general, reconstructed image quality using JPEG compression can vary over a wide range and is a function of the compression ratio, which is the ratio of the original image data size to the size of the compressed data. Reconstructed image quality can range from being virtually indistinguishable from the source image (for example, at a JPEG compression ratio of 3) to abstract art (at compression ratios of 100 times smaller than the original). Generally, visible differences in the reconstructed image as compared to the source image begin to occur at compression ratios between ten and twenty times smaller than the original.
Wavelets are mathematical functions that filter data into different frequency components. For the purposes of this document, the term xe2x80x9cwavelet compressionxe2x80x9d is defined to mean (A) the application of a wavelet (or wavelet-like) decomposition transform to a set of data, which produces a set of decomposition coefficients (also called wavelet coefficients), (B) quantization of the coefficients, and (C) encoding of the quantized decomposition coefficients. Application of the wavelet decomposition transform, by itself, is lossless, meaning that no information is lost. The encoding step is also lossless. However, the quantization step, in which all the coefficients are divided by a value (called the quantization divisor) that corresponds to a selected compression ratio, causes information loss. The amount of information loss corresponds generally to the size of the quantization divisor.
As with JPEG compression, when wavelet compression is used, the reconstructed image quality can vary over a wide range and is also a function of the compressed ratio. Wavelet compressed YUV image data tends not to vary as greatly in image quality as similarly compressed and restored JPEG images. However, the inventors of the present invention have noticed that at xe2x80x9clowxe2x80x9d compression ratios (e.g., compression ratios of less than twenty to one (20:1)) JPEG compression achieves better quality compression of U and V data than wavelet decomposition transforms, while at high compression levels (e.g., compression ratios of more than 20:1) wavelet compression achieves better quality compression of U and V data than JPEG compression. That is, at low compression levels, JPEG compressed U and V data, when reconstructed, usually results in a higher quality image than wavelet compressed U and V data for the same amount of data compression. However, wavelet compression usually outperforms JPEG compression at all compression ratios for Y data.
Actually, the xe2x80x9chigh/lowxe2x80x9d compression ratio analysis is not quite as simple as noted above, because at very low compression ratios, below 5:1, there is essentially no difference between wavelet and JPEG in reconstructed image quality. However, these xe2x80x9csuper-lowxe2x80x9d compression ratios are used primarily when lossless image processing is required, which typically limits the compression ratio to about 2.5:1.
The present invention is an improvement over the compression mechanisms typically used for compressing still, digital, color image data. One object of the present invention is to improve the image quality of compressed and reconstructed still digital images. The present invention accomplishes this objective by providing a hybrid encoding methodology and system for utilizing the relative strengths of the JPEG and wavelet decomposition transform compression mechanisms at different compression ratios to compress digital image data.
In summary, the present invention is a unified system and method for encoding and decoding YUV image data. To compress raw image data, an encoding procedure is executed. Prior to executing the encoding procedure, or alternately at the beginning of the encoding procedure, one or more data preparation steps may be performed. Data preparation begins by determining if raw image data is in the YUV data format. For example, if the raw image data is RGB data, a data converter is used to convert the raw image data from RGB data to YUV data, using well known conversion equations.
The data encoding procedure compresses the Y data using wavelet compression. The U and V data (or Cb and Cr data) is compressed either by performing wavelet compression or JPEG compression, depending on the compression ratio or image quality level selected.
At low compression ratios (e.g., less than a specified or predefined threshold, Th) the image data encoding method uses JPEG compression to compress the U and V data because JPEG compression achieves better quality compression of U and V data than wavelet decomposition transforms. That is, at low compression levels (e.g., compression ratios below 20:1), JPEG compressed U and V data, when reconstructed, usually results in a higher quality image than wavelet compressed U and V data for the same amount of data compression. At higher compression levels, the data encoding method uses wavelet compression to compress the U and V data, which achieves better quality compression of U and V data than JPEG compression.
To reconstruct a compressed image, a data decoding procedure is executed. Prior to the executing the data decoding procedure, of alternately during its execution, the type of encoding transformation (wavelet or JPEG) used to compress and encode the U and V data is determined. This information is used to access the appropriate transform decoder module for decoding the compressed U and V data. The decoding procedure reverses the process performed by the encoding method.